using System.IO;
using UnityEngine;

namespace Assets.Common.DataStruct.Interface
{
    public interface IHealth
    {
        public int Health { get; set; }
    }
    public interface IDamage
    {
        public int Damage { get; set; }
    }
    public interface IToolTipsData
    {
        public void SetToolTipsData();
    }
    public interface ITickable {
        public void TickUpdate(float tick);
    }
    /// <summary>
    /// 通过鼠标拖动设置方向的
    /// </summary>
    public interface IDragDir
    {
        public void Drag(Vector3 start, Vector3 end);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="direction">Dir int n</param>
        public void Drag(int direction);
    }

    /// <summary>
    /// 获取经验值
    /// </summary>
    public interface ILevelExp
    {
        public int GetExp();
    }
    public interface ISaveData
    {
        void Save(BinaryWriter writer);
    }
    public interface ILoadData
    {
        void Load(BinaryReader reader, int header);
    }
//public interface IRunState 
//{
//    public bool IsRuning { get;}
//}

    public interface ICondition
    {
        public string CheckFailMessage { get; }
        public bool CheckCondition();
    }
    public abstract class Condition : ICondition
    {
        public virtual void Init() { }
        public virtual string CheckFailMessage { get => this.GetType().Name; }
        public abstract bool CheckCondition();
 
    }
    public abstract class Condition<T> : Condition
    {
        //public enum Compare
        protected T _value;

        protected Condition()
        {
        }

        protected Condition(T value)
        {
            _value = value;
        }
        public void SetValue(T v) { _value = v; }
        public override bool CheckCondition()
        {
            return CheckCondition(_value);
        }

        public abstract bool CheckCondition(T value);

    }
}